import request from '@/request/request.js';

//获取终端信息
export const getTerminal = (key) => {
  return request({
    url: `/terminal/${key}`,
    method: 'GET',
  })
}

// 获取柜机信息
export const getTerminalCabinet = (serialNumber) => {
  return request({
    url: `/terminal/cabinet/${serialNumber}`,
    method: 'GET',
  })
}

// 获取资质信息
export const getTerminalStore = (serialNumber) => {
  return request({
    url: `/terminal/store/${serialNumber}`,
    method: 'GET',
  })
}

// 获取广告信息
export const getTerminalAdList = (serialNumber) => {
  return request({
    url: `/terminal/cabinetAd/${serialNumber}`,
    method: 'GET',
  })
}

// 取药
export const takeMedication = (source, medicationCode) => {
  return request({
    url: `/terminal/cabinet/${source}/${medicationCode}`,
    method: 'GET',
  }, false)
}

// 取药
export const takeOutMedication = (data) => {
  return request({
    url: `/terminal/cabinet/takeOut`,
    method: 'POST',
    data
  }, false)
}

// 绑定柜机
export const bindSerialNumber = (data) => {
  return request({
    url: `/terminal/bindSerialNumber`,
    method: 'POST',
    data
  })
}

// 解绑柜机
export const unbindSerialNumber = (data) => {
  return request({
    url: `/terminal/unbindSerialNumber`,
    method: 'POST',
    data
  })
}

// 新增心跳记录
export const saveHeartbeat = (data) => {
  return request({
    url: `/terminal/saveHeartbeat`,
    method: 'POST',
    data
  })
}

// 温湿度列表
export const heartbeatList = (data) => {
  return request({
    url: `/terminal/heartbeatList`,
    method: 'GET',
    data
  })
}

// 订单反馈
export const orderFeedback = (data) => {
  return request({
    url: `/terminal/order/feedback`,
    method: 'POST',
    data
  })
}